-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
feat(status-page): add per-status-page language setting for anonymous visitors #6615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(status-page): add per-status-page language setting for anonymous visitors #6615
Conversation
… visitors Adds a language dropdown in the status page settings that allows admins to set a specific display language for anonymous visitors. When configured, anonymous visitors will see the status page in the selected language instead of their browser's default language. Fixes louislam#5836 Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=101010297
This comment was marked as spam.
This comment was marked as spam.
CommanderStorm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don’t ping maintainers unless it’s necessary (e.g. to clarify blocking questions).
I need to set a clear boundary here: repeated or unnecessary pings slow things down rather than speed them up. PRs are reviewed in order as time allows, and excessive nudging disrupts that process.
On the PR:
- functionality looks good and works
- but some of the code needs minor cleanup before we can merge
| async changeLang(lang, options = {}) { | ||
| const persist = options.persist !== false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use single-item options as it is harder to reason about them when only used once
| async changeLang(lang, options = {}) { | |
| const persist = options.persist !== false; | |
| async changeLang(lang, persist = true) { |
src/pages/StatusPage.vue
Outdated
| // Apply configured language if the visitor hasn't set their own preference | ||
| if (this.config.language && !localStorage.locale) { | ||
| this.$root.setLanguage(this.config.language, { persist: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not changeLang?
| if (!("language" in this.config)) { | ||
| this.config.language = null; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this happening?
| data() { | ||
| return { | ||
| language: currentLocale(), | ||
| persistLanguage: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is only ever written, what are you trying to do here?
| * @returns {void} | ||
| */ | ||
| export function setPageLocale() { | ||
| export function setPageLocale(locale = currentLocale()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is resonably hard to read. Please change it like this instead and adjust the callsites.
This feedback also is applicable to localeDirection
| export function setPageLocale(locale = currentLocale()) { | |
| export function setPageLocale(locale) { |
| if (typeof config.language === "string" && config.language.trim() !== "") { | ||
| statusPage.language = config.language.trim(); | ||
| } else { | ||
| statusPage.language = null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the equivalent, or?
| if (typeof config.language === "string" && config.language.trim() !== "") { | |
| statusPage.language = config.language.trim(); | |
| } else { | |
| statusPage.language = null; | |
| } | |
| statusPage.language = config.language?.trim() || null; |
| if (!("language" in this.config)) { | ||
| this.config.language = null; | ||
| } | ||
| if (this.config.icon) { | ||
| this.imgDataUrl = this.config.icon; | ||
| } | ||
| // Apply configured language if the visitor hasn't set their own preference | ||
| if (this.config.language && !localStorage.locale) { | ||
| this.$root.setLanguage(this.config.language, { persist: false }); | ||
| } | ||
| this.incident = res.data.incident; | ||
| this.maintenanceList = res.data.maintenanceList; | ||
| this.$root.publicGroupList = res.data.publicGroupList; | ||
| if (!this.config.domainNameList) { | ||
| this.config.domainNameList = []; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please explain what you added here and why.
This might have been a merge issue with master..
| "Leave blank to use status page title": "Leave blank to use status page title", | ||
| "Status Page Language": "Status Page Language", | ||
| "Use browser language": "Use browser language", | ||
| "statusPageLanguageDescription": "Set the display language for anonymous visitors to this status page", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can be more explicit here what this does
| "statusPageLanguageDescription": "Set the display language for anonymous visitors to this status page", | |
| "statusPageLanguageDescription": "Set the display language for anonymous visitors to this status page. Logged-in users can change the language they see in their own settings.", |
Summary
languagecolumn tostatus_pagetableFixes #5836
Changes
2026-01-06-0000-add-status-page-language.jsserver/model/status_page.jsto include language in JSON outputserver/socket-handlers/status-page-socket-handler.jsto save language settingsrc/pages/StatusPage.vuesrc/lang/en.jsonsrc/mixins/lang.jsto support non-persisted language changessrc/i18n.jsandsrc/util-frontend.jsfor status page language supportTest plan
All tests completed successfully:
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=101010297